package behavioral_pattern.command_pattern.test1;

import java.util.ArrayList;

/**
 * 功能键设置窗口类
 */

public class FBSettingWindow {

    private String title;

    //定义一个ArrayList来存储所有功能键
    private ArrayList<FunctionButton> functionButtons = new ArrayList<>();

    public FBSettingWindow(String title) {
        this.title = title;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public void addFunctionButton(FunctionButton functionButton){
        functionButtons.add(functionButton);
    }

    public void removeFunctionButton(FunctionButton functionButton){
        functionButtons.remove(functionButton);
    }

    public void disPlay(){
        System.out.println("显示窗口:"+this.title);
        System.out.println("显示功能键：");
        for (FunctionButton functionButton : functionButtons) {
            System.out.println(functionButton.getName());
        }
        System.out.println("------------------------");
    }
}
